﻿using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata;

namespace EntityFrameworkCRUD.Core.Models
{
    public partial class BTTESTContext : DbContext
    {
        public BTTESTContext()
        {
        }

        public BTTESTContext(DbContextOptions<BTTESTContext> options)
            : base(options)
        {
        }

        public virtual DbSet<AggregatedCounter> AggregatedCounter { get; set; }
        public virtual DbSet<Article> Article { get; set; }
        public virtual DbSet<ArticleCategory> ArticleCategory { get; set; }
        public virtual DbSet<Counter> Counter { get; set; }
        public virtual DbSet<ExchangeRate> ExchangeRate { get; set; }
        public virtual DbSet<Hash> Hash { get; set; }
        public virtual DbSet<HistoryDealedOrderReport> HistoryDealedOrderReport { get; set; }
        public virtual DbSet<Job> Job { get; set; }
        public virtual DbSet<JobParameter> JobParameter { get; set; }
        public virtual DbSet<JobQueue> JobQueue { get; set; }
        public virtual DbSet<List> List { get; set; }
        public virtual DbSet<Manager> Manager { get; set; }
        public virtual DbSet<ManagerBankCard> ManagerBankCard { get; set; }
        public virtual DbSet<ManagerData> ManagerData { get; set; }
        public virtual DbSet<ManagerLog> ManagerLog { get; set; }
        public virtual DbSet<ManagerRole> ManagerRole { get; set; }
        public virtual DbSet<ManagerToken> ManagerToken { get; set; }
        public virtual DbSet<Menu> Menu { get; set; }
        public virtual DbSet<Nlog> Nlog { get; set; }
        public virtual DbSet<RebateExtract> RebateExtract { get; set; }
        public virtual DbSet<RebateRecord> RebateRecord { get; set; }
        public virtual DbSet<RolePermission> RolePermission { get; set; }
        public virtual DbSet<Schema> Schema { get; set; }
        public virtual DbSet<Server> Server { get; set; }
        public virtual DbSet<ServiceCharge> ServiceCharge { get; set; }
        public virtual DbSet<Set> Set { get; set; }
        public virtual DbSet<State> State { get; set; }
        public virtual DbSet<SysItems> SysItems { get; set; }
        public virtual DbSet<SysItemsDetail> SysItemsDetail { get; set; }
        public virtual DbSet<SysSafeHostAddress> SysSafeHostAddress { get; set; }
        public virtual DbSet<TradeCommission> TradeCommission { get; set; }
        public virtual DbSet<UcalipayInCash> UcalipayInCash { get; set; }
        public virtual DbSet<UcexchangeRate> UcexchangeRate { get; set; }
        public virtual DbSet<UcexchangeRateManager> UcexchangeRateManager { get; set; }
        public virtual DbSet<UcinOutCash> UcinOutCash { get; set; }
        public virtual DbSet<Video> Video { get; set; }

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            if (!optionsBuilder.IsConfigured)
            {
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. See http://go.microsoft.com/fwlink/?LinkId=723263 for guidance on storing connection strings.
                optionsBuilder.UseSqlServer("Data Source=.;Initial Catalog=BT.TEST;User ID=sa;Password=sql2008");
            }
        }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.HasAnnotation("ProductVersion", "2.2.0-rtm-35687");

            modelBuilder.Entity<AggregatedCounter>(entity =>
            {
                entity.ToTable("AggregatedCounter", "HangFire");

                entity.HasIndex(e => new { e.Value, e.Key })
                    .HasName("UX_HangFire_CounterAggregated_Key")
                    .IsUnique();

                entity.Property(e => e.ExpireAt).HasColumnType("datetime");

                entity.Property(e => e.Key)
                    .IsRequired()
                    .HasMaxLength(100);
            });

            modelBuilder.Entity<Article>(entity =>
            {
                entity.HasKey(e => e.Id)
                    .HasName("PK_ARTICLE")
                    .ForSqlServerIsClustered(false);

                entity.Property(e => e.AddTime)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.Author)
                    .HasMaxLength(64)
                    .IsUnicode(false);

                entity.Property(e => e.Content).HasColumnType("text");

                entity.Property(e => e.ImageUrl)
                    .HasMaxLength(128)
                    .IsUnicode(false);

                entity.Property(e => e.ModifyTime).HasColumnType("datetime");

                entity.Property(e => e.SeoDescription)
                    .HasMaxLength(512)
                    .IsUnicode(false);

                entity.Property(e => e.SeoKeyword)
                    .HasMaxLength(256)
                    .IsUnicode(false);

                entity.Property(e => e.SeoTitle)
                    .HasMaxLength(128)
                    .IsUnicode(false);

                entity.Property(e => e.Source)
                    .HasMaxLength(128)
                    .IsUnicode(false);

                entity.Property(e => e.Title)
                    .IsRequired()
                    .HasMaxLength(128)
                    .IsUnicode(false);
            });

            modelBuilder.Entity<ArticleCategory>(entity =>
            {
                entity.HasKey(e => e.Id)
                    .HasName("PK_ARTICLECATEGORY")
                    .ForSqlServerIsClustered(false);

                entity.Property(e => e.ClassList)
                    .HasMaxLength(128)
                    .IsUnicode(false);

                entity.Property(e => e.ImageUrl)
                    .HasMaxLength(128)
                    .IsUnicode(false);

                entity.Property(e => e.SeoDescription)
                    .HasMaxLength(512)
                    .IsUnicode(false);

                entity.Property(e => e.SeoKeywords)
                    .HasMaxLength(256)
                    .IsUnicode(false);

                entity.Property(e => e.SeoTitle)
                    .HasMaxLength(128)
                    .IsUnicode(false);

                entity.Property(e => e.Title)
                    .IsRequired()
                    .HasMaxLength(128)
                    .IsUnicode(false);
            });

            modelBuilder.Entity<Counter>(entity =>
            {
                entity.ToTable("Counter", "HangFire");

                entity.HasIndex(e => new { e.Value, e.Key })
                    .HasName("IX_HangFire_Counter_Key");

                entity.Property(e => e.ExpireAt).HasColumnType("datetime");

                entity.Property(e => e.Key)
                    .IsRequired()
                    .HasMaxLength(100);
            });

            modelBuilder.Entity<ExchangeRate>(entity =>
            {
                entity.HasKey(e => e.Id)
                    .HasName("PK_EXCHANGERATE")
                    .ForSqlServerIsClustered(false);

                entity.Property(e => e.AddTime)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.ModifyTime).HasColumnType("datetime");

                entity.Property(e => e.ProjectCode)
                    .HasMaxLength(16)
                    .IsUnicode(false);

                entity.Property(e => e.ProjectName)
                    .HasMaxLength(64)
                    .IsUnicode(false);

                entity.Property(e => e.ProjectPrice).HasColumnType("numeric(18, 8)");

                entity.Property(e => e.ProjectTime).HasColumnType("date");
            });

            modelBuilder.Entity<Hash>(entity =>
            {
                entity.ToTable("Hash", "HangFire");

                entity.HasIndex(e => new { e.ExpireAt, e.Key })
                    .HasName("IX_HangFire_Hash_Key");

                entity.HasIndex(e => new { e.Id, e.ExpireAt })
                    .HasName("IX_HangFire_Hash_ExpireAt");

                entity.HasIndex(e => new { e.Key, e.Field })
                    .HasName("UX_HangFire_Hash_Key_Field")
                    .IsUnique();

                entity.Property(e => e.Field)
                    .IsRequired()
                    .HasMaxLength(100);

                entity.Property(e => e.Key)
                    .IsRequired()
                    .HasMaxLength(100);
            });

            modelBuilder.Entity<HistoryDealedOrderReport>(entity =>
            {
                entity.HasKey(e => e.Id)
                    .HasName("PK_HISTORY_DEALED_ORDER_REPORT")
                    .ForSqlServerIsClustered(false);

                entity.ToTable("History_DealedOrderReport");

                entity.Property(e => e.AccountName)
                    .HasMaxLength(64)
                    .IsUnicode(false);

                entity.Property(e => e.AddTime)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.ByManual)
                    .HasMaxLength(16)
                    .IsUnicode(false);

                entity.Property(e => e.CarryDate)
                    .HasColumnName("Carry_Date")
                    .HasMaxLength(16)
                    .IsUnicode(false);

                entity.Property(e => e.CcustFee)
                    .HasColumnName("CCustFee")
                    .HasColumnType("numeric(18, 6)");

                entity.Property(e => e.Currency)
                    .HasMaxLength(16)
                    .IsUnicode(false);

                entity.Property(e => e.CustFee).HasColumnType("numeric(18, 6)");

                entity.Property(e => e.CustGroup)
                    .HasMaxLength(32)
                    .IsUnicode(false);

                entity.Property(e => e.DataFeeder)
                    .HasMaxLength(32)
                    .IsUnicode(false);

                entity.Property(e => e.DealedAsset).HasColumnType("numeric(18, 6)");

                entity.Property(e => e.DealedDate).HasColumnType("datetime");

                entity.Property(e => e.DealedNumber)
                    .HasMaxLength(64)
                    .IsUnicode(false);

                entity.Property(e => e.DealedPrice).HasColumnType("numeric(18, 6)");

                entity.Property(e => e.DealedTime)
                    .HasMaxLength(16)
                    .IsUnicode(false);

                entity.Property(e => e.DispExchCode)
                    .HasColumnName("DispExch_Code")
                    .HasMaxLength(16)
                    .IsUnicode(false);

                entity.Property(e => e.FcmCode)
                    .HasColumnName("FCM_Code")
                    .HasMaxLength(32)
                    .IsUnicode(false);

                entity.Property(e => e.FcmExecId)
                    .HasColumnName("FCM_Exec_ID")
                    .HasMaxLength(32)
                    .IsUnicode(false);

                entity.Property(e => e.FcmFee)
                    .HasColumnName("FCM_Fee")
                    .HasColumnType("numeric(18, 6)");

                entity.Property(e => e.FcmName)
                    .HasColumnName("FCM_Name")
                    .HasMaxLength(32)
                    .IsUnicode(false);

                entity.Property(e => e.ForceClose)
                    .HasMaxLength(16)
                    .IsUnicode(false);

                entity.Property(e => e.LastTradingDate)
                    .HasMaxLength(16)
                    .IsUnicode(false);

                entity.Property(e => e.LmesettleDate)
                    .HasColumnName("LMESettleDate")
                    .HasMaxLength(16)
                    .IsUnicode(false);

                entity.Property(e => e.ModifyTime).HasColumnType("datetime");

                entity.Property(e => e.NodeName)
                    .HasMaxLength(64)
                    .IsUnicode(false);

                entity.Property(e => e.OptionType)
                    .HasMaxLength(16)
                    .IsUnicode(false);

                entity.Property(e => e.OrderId)
                    .HasColumnName("Order_ID")
                    .HasMaxLength(32)
                    .IsUnicode(false);

                entity.Property(e => e.PfCode)
                    .HasMaxLength(16)
                    .IsUnicode(false);

                entity.Property(e => e.RealName)
                    .HasMaxLength(64)
                    .IsUnicode(false);

                entity.Property(e => e.StrikePrice).HasColumnType("numeric(18, 6)");

                entity.Property(e => e.TradeSide)
                    .HasMaxLength(16)
                    .IsUnicode(false);

                entity.Property(e => e.TradeStyle)
                    .HasMaxLength(16)
                    .IsUnicode(false);

                entity.Property(e => e.UserName)
                    .HasMaxLength(64)
                    .IsUnicode(false);
            });

            modelBuilder.Entity<Job>(entity =>
            {
                entity.ToTable("Job", "HangFire");

                entity.HasIndex(e => e.StateName)
                    .HasName("IX_HangFire_Job_StateName");

                entity.HasIndex(e => new { e.Id, e.ExpireAt })
                    .HasName("IX_HangFire_Job_ExpireAt");

                entity.Property(e => e.Arguments).IsRequired();

                entity.Property(e => e.CreatedAt).HasColumnType("datetime");

                entity.Property(e => e.ExpireAt).HasColumnType("datetime");

                entity.Property(e => e.InvocationData).IsRequired();

                entity.Property(e => e.StateName).HasMaxLength(20);
            });

            modelBuilder.Entity<JobParameter>(entity =>
            {
                entity.ToTable("JobParameter", "HangFire");

                entity.HasIndex(e => new { e.JobId, e.Name })
                    .HasName("IX_HangFire_JobParameter_JobIdAndName");

                entity.Property(e => e.Name)
                    .IsRequired()
                    .HasMaxLength(40);

                entity.HasOne(d => d.Job)
                    .WithMany(p => p.JobParameter)
                    .HasForeignKey(d => d.JobId)
                    .HasConstraintName("FK_HangFire_JobParameter_Job");
            });

            modelBuilder.Entity<JobQueue>(entity =>
            {
                entity.ToTable("JobQueue", "HangFire");

                entity.HasIndex(e => new { e.Queue, e.FetchedAt })
                    .HasName("IX_HangFire_JobQueue_QueueAndFetchedAt");

                entity.Property(e => e.FetchedAt).HasColumnType("datetime");

                entity.Property(e => e.Queue)
                    .IsRequired()
                    .HasMaxLength(50);
            });

            modelBuilder.Entity<List>(entity =>
            {
                entity.ToTable("List", "HangFire");

                entity.HasIndex(e => new { e.Id, e.ExpireAt })
                    .HasName("IX_HangFire_List_ExpireAt");

                entity.HasIndex(e => new { e.ExpireAt, e.Value, e.Key })
                    .HasName("IX_HangFire_List_Key");

                entity.Property(e => e.ExpireAt).HasColumnType("datetime");

                entity.Property(e => e.Key)
                    .IsRequired()
                    .HasMaxLength(100);

                entity.Property(e => e.Value).HasColumnType("nvarchar(max)");
            });

            modelBuilder.Entity<Manager>(entity =>
            {
                entity.HasKey(e => e.Id)
                    .HasName("PK_MANAGER")
                    .ForSqlServerIsClustered(false);

                entity.Property(e => e.AddTime)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.AuditRemark)
                    .HasMaxLength(300)
                    .IsUnicode(false);

                entity.Property(e => e.Avatar)
                    .HasMaxLength(256)
                    .IsUnicode(false);

                entity.Property(e => e.BankCard)
                    .HasMaxLength(256)
                    .IsUnicode(false);

                entity.Property(e => e.BankCity)
                    .HasMaxLength(16)
                    .IsUnicode(false);

                entity.Property(e => e.BankProvince)
                    .HasMaxLength(16)
                    .IsUnicode(false);

                entity.Property(e => e.BankType)
                    .HasMaxLength(32)
                    .IsUnicode(false);

                entity.Property(e => e.CardId)
                    .HasMaxLength(256)
                    .IsUnicode(false);

                entity.Property(e => e.DeptCode)
                    .HasMaxLength(16)
                    .IsUnicode(false);

                entity.Property(e => e.Email)
                    .HasMaxLength(256)
                    .IsUnicode(false);

                entity.Property(e => e.InvitationCode)
                    .HasMaxLength(64)
                    .IsUnicode(false);

                entity.Property(e => e.LoginLastIp)
                    .HasMaxLength(64)
                    .IsUnicode(false);

                entity.Property(e => e.LoginLastTime).HasColumnType("datetime");

                entity.Property(e => e.Mobile)
                    .HasMaxLength(128)
                    .IsUnicode(false);

                entity.Property(e => e.ModifyTime).HasColumnType("datetime");

                entity.Property(e => e.NickName)
                    .HasMaxLength(32)
                    .IsUnicode(false);

                entity.Property(e => e.Password)
                    .IsRequired()
                    .HasMaxLength(128)
                    .IsUnicode(false);

                entity.Property(e => e.Qq)
                    .HasColumnName("QQ")
                    .HasMaxLength(128)
                    .IsUnicode(false);

                entity.Property(e => e.RealName)
                    .HasMaxLength(32)
                    .IsUnicode(false);

                entity.Property(e => e.Remark)
                    .HasMaxLength(128)
                    .IsUnicode(false);

                entity.Property(e => e.UserName)
                    .IsRequired()
                    .HasMaxLength(32)
                    .IsUnicode(false);
            });

            modelBuilder.Entity<ManagerBankCard>(entity =>
            {
                entity.Property(e => e.AddTime).HasColumnType("datetime");

                entity.Property(e => e.BankCard)
                    .IsRequired()
                    .HasMaxLength(32)
                    .IsUnicode(false);

                entity.Property(e => e.BankCity)
                    .HasMaxLength(16)
                    .IsUnicode(false);

                entity.Property(e => e.BankProvince)
                    .HasMaxLength(16)
                    .IsUnicode(false);

                entity.Property(e => e.BankType)
                    .IsRequired()
                    .HasMaxLength(32)
                    .IsUnicode(false);

                entity.Property(e => e.ModifyTime).HasColumnType("datetime");
            });

            modelBuilder.Entity<ManagerData>(entity =>
            {
                entity.Property(e => e.AddTime).HasColumnType("datetime");

                entity.Property(e => e.ImageUrl)
                    .HasMaxLength(128)
                    .IsUnicode(false);
            });

            modelBuilder.Entity<ManagerLog>(entity =>
            {
                entity.HasKey(e => e.Id)
                    .HasName("PK_MANAGERLOG")
                    .ForSqlServerIsClustered(false);

                entity.Property(e => e.ActionType)
                    .HasMaxLength(32)
                    .IsUnicode(false);

                entity.Property(e => e.AddIp)
                    .HasMaxLength(64)
                    .IsUnicode(false);

                entity.Property(e => e.AddManagerNickName)
                    .HasMaxLength(64)
                    .IsUnicode(false);

                entity.Property(e => e.AddTime)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.Remark)
                    .HasMaxLength(256)
                    .IsUnicode(false);
            });

            modelBuilder.Entity<ManagerRole>(entity =>
            {
                entity.HasKey(e => e.Id)
                    .HasName("PK_MANAGERROLE")
                    .ForSqlServerIsClustered(false);

                entity.Property(e => e.AddTime)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.ModifyTime).HasColumnType("datetime");

                entity.Property(e => e.Remark)
                    .HasMaxLength(128)
                    .IsUnicode(false);

                entity.Property(e => e.RoleName)
                    .IsRequired()
                    .HasMaxLength(64)
                    .IsUnicode(false);
            });

            modelBuilder.Entity<ManagerToken>(entity =>
            {
                entity.Property(e => e.AddTime)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.Token).HasMaxLength(64);
            });

            modelBuilder.Entity<Menu>(entity =>
            {
                entity.HasKey(e => e.Id)
                    .HasName("PK_MENU")
                    .ForSqlServerIsClustered(false);

                entity.Property(e => e.AddTime)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.DisplayName)
                    .HasMaxLength(128)
                    .IsUnicode(false);

                entity.Property(e => e.IconUrl)
                    .HasMaxLength(128)
                    .IsUnicode(false);

                entity.Property(e => e.LinkUrl)
                    .HasMaxLength(128)
                    .IsUnicode(false);

                entity.Property(e => e.ModifyTime).HasColumnType("datetime");

                entity.Property(e => e.Name)
                    .IsRequired()
                    .HasMaxLength(32)
                    .IsUnicode(false);

                entity.Property(e => e.Permission)
                    .HasMaxLength(256)
                    .IsUnicode(false);
            });

            modelBuilder.Entity<Nlog>(entity =>
            {
                entity.ToTable("NLog");

                entity.Property(e => e.Application).HasMaxLength(50);

                entity.Property(e => e.Callsite).HasMaxLength(512);

                entity.Property(e => e.Level).HasMaxLength(50);

                entity.Property(e => e.Logged).HasColumnType("datetime");

                entity.Property(e => e.Logger).HasMaxLength(250);
            });

            modelBuilder.Entity<RebateExtract>(entity =>
            {
                entity.HasKey(e => e.Id)
                    .HasName("PK_REBATEEXTRACT")
                    .ForSqlServerIsClustered(false);

                entity.Property(e => e.AddTime)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.ApplyTime).HasColumnType("datetime");

                entity.Property(e => e.AuditTime).HasColumnType("datetime");

                entity.Property(e => e.BankCard)
                    .HasMaxLength(32)
                    .IsUnicode(false);

                entity.Property(e => e.BankCity)
                    .HasMaxLength(16)
                    .IsUnicode(false);

                entity.Property(e => e.BankProvince)
                    .HasMaxLength(16)
                    .IsUnicode(false);

                entity.Property(e => e.BankType)
                    .HasMaxLength(32)
                    .IsUnicode(false);

                entity.Property(e => e.DealedNumber)
                    .HasMaxLength(64)
                    .IsUnicode(false);

                entity.Property(e => e.ExtractRmbmoney)
                    .HasColumnName("ExtractRMBMoney")
                    .HasColumnType("numeric(18, 2)");

                entity.Property(e => e.ExtractRmbtype).HasColumnName("ExtractRMBType");

                entity.Property(e => e.ManagerName)
                    .HasMaxLength(64)
                    .IsUnicode(false);

                entity.Property(e => e.ManagerRealName)
                    .HasMaxLength(64)
                    .IsUnicode(false);

                entity.Property(e => e.ModifyTime).HasColumnType("datetime");

                entity.Property(e => e.State).HasDefaultValueSql("((0))");
            });

            modelBuilder.Entity<RebateRecord>(entity =>
            {
                entity.HasKey(e => e.Id)
                    .HasName("PK_REBATERECORD")
                    .ForSqlServerIsClustered(false);

                entity.Property(e => e.AddTime)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.Currency)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.DealedNumber)
                    .HasMaxLength(64)
                    .IsUnicode(false);

                entity.Property(e => e.ManagerName)
                    .HasMaxLength(64)
                    .IsUnicode(false);

                entity.Property(e => e.ManagerRealName)
                    .HasMaxLength(64)
                    .IsUnicode(false);

                entity.Property(e => e.ModifyTime).HasColumnType("datetime");

                entity.Property(e => e.ParentManagerName)
                    .HasMaxLength(64)
                    .IsUnicode(false);

                entity.Property(e => e.PmanagerRealName)
                    .HasColumnName("PManagerRealName")
                    .HasMaxLength(64)
                    .IsUnicode(false);

                entity.Property(e => e.ProjectCode)
                    .HasMaxLength(16)
                    .IsUnicode(false);

                entity.Property(e => e.ProjectName)
                    .HasMaxLength(64)
                    .IsUnicode(false);

                entity.Property(e => e.RebateMoney).HasColumnType("numeric(18, 2)");

                entity.Property(e => e.RebateRmbmoney)
                    .HasColumnName("RebateRMBMoney")
                    .HasColumnType("numeric(18, 2)");

                entity.Property(e => e.Remark)
                    .HasMaxLength(256)
                    .IsUnicode(false);

                entity.Property(e => e.ServiceChargeMoney).HasColumnType("numeric(18, 2)");

                entity.Property(e => e.TransactionNo)
                    .HasMaxLength(16)
                    .IsUnicode(false);

                entity.Property(e => e.TransactionTime).HasColumnType("datetime");
            });

            modelBuilder.Entity<RolePermission>(entity =>
            {
                entity.HasKey(e => e.Id)
                    .HasName("PK_ROLEPERMISSION")
                    .ForSqlServerIsClustered(false);

                entity.Property(e => e.Permission)
                    .HasMaxLength(128)
                    .IsUnicode(false);
            });

            modelBuilder.Entity<Schema>(entity =>
            {
                entity.HasKey(e => e.Version)
                    .HasName("PK_HangFire_Schema");

                entity.ToTable("Schema", "HangFire");

                entity.Property(e => e.Version).ValueGeneratedNever();
            });

            modelBuilder.Entity<Server>(entity =>
            {
                entity.ToTable("Server", "HangFire");

                entity.Property(e => e.Id)
                    .HasMaxLength(100)
                    .ValueGeneratedNever();

                entity.Property(e => e.LastHeartbeat).HasColumnType("datetime");
            });

            modelBuilder.Entity<ServiceCharge>(entity =>
            {
                entity.HasKey(e => e.Id)
                    .HasName("PK_SERVICECHARGE")
                    .ForSqlServerIsClustered(false);

                entity.Property(e => e.AddTime)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.AgentTrade).HasColumnType("numeric(18, 2)");

                entity.Property(e => e.ModifyTime).HasColumnType("datetime");

                entity.Property(e => e.ProjectCode)
                    .HasMaxLength(16)
                    .IsUnicode(false);

                entity.Property(e => e.ProjectName)
                    .HasMaxLength(64)
                    .IsUnicode(false);

                entity.Property(e => e.ProjectPrice).HasColumnType("numeric(18, 2)");

                entity.Property(e => e.ProjectTime).HasColumnType("date");

                entity.Property(e => e.ProjectUnit)
                    .HasMaxLength(16)
                    .IsUnicode(false);

                entity.Property(e => e.SalesTrade).HasColumnType("numeric(18, 2)");
            });

            modelBuilder.Entity<Set>(entity =>
            {
                entity.ToTable("Set", "HangFire");

                entity.HasIndex(e => new { e.Id, e.ExpireAt })
                    .HasName("IX_HangFire_Set_ExpireAt");

                entity.HasIndex(e => new { e.Key, e.Value })
                    .HasName("UX_HangFire_Set_KeyAndValue")
                    .IsUnique();

                entity.HasIndex(e => new { e.ExpireAt, e.Value, e.Key })
                    .HasName("IX_HangFire_Set_Key");

                entity.Property(e => e.ExpireAt).HasColumnType("datetime");

                entity.Property(e => e.Key)
                    .IsRequired()
                    .HasMaxLength(100);

                entity.Property(e => e.Value)
                    .IsRequired()
                    .HasMaxLength(256);
            });

            modelBuilder.Entity<State>(entity =>
            {
                entity.ToTable("State", "HangFire");

                entity.HasIndex(e => e.JobId)
                    .HasName("IX_HangFire_State_JobId");

                entity.Property(e => e.CreatedAt).HasColumnType("datetime");

                entity.Property(e => e.Name)
                    .IsRequired()
                    .HasMaxLength(20);

                entity.Property(e => e.Reason).HasMaxLength(100);

                entity.HasOne(d => d.Job)
                    .WithMany(p => p.State)
                    .HasForeignKey(d => d.JobId)
                    .HasConstraintName("FK_HangFire_State_Job");
            });

            modelBuilder.Entity<SysItems>(entity =>
            {
                entity.HasKey(e => e.Id)
                    .HasName("PK_SYSITEMS")
                    .ForSqlServerIsClustered(false);

                entity.Property(e => e.Id).ValueGeneratedNever();

                entity.Property(e => e.AddTime).HasColumnType("datetime");

                entity.Property(e => e.CodeName)
                    .HasMaxLength(64)
                    .IsUnicode(false);

                entity.Property(e => e.EnCode)
                    .HasMaxLength(16)
                    .IsUnicode(false);

                entity.Property(e => e.ModifyTime).HasColumnType("datetime");
            });

            modelBuilder.Entity<SysItemsDetail>(entity =>
            {
                entity.HasKey(e => e.Id)
                    .HasName("PK_SYSITEMSDETAIL")
                    .ForSqlServerIsClustered(false);

                entity.Property(e => e.AddTime)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.ItemCode)
                    .HasMaxLength(16)
                    .IsUnicode(false);

                entity.Property(e => e.ItemData)
                    .HasMaxLength(64)
                    .IsUnicode(false);

                entity.Property(e => e.ItemName)
                    .HasMaxLength(64)
                    .IsUnicode(false);

                entity.Property(e => e.ModifyTime).HasColumnType("datetime");
            });

            modelBuilder.Entity<SysSafeHostAddress>(entity =>
            {
                entity.Property(e => e.HostName)
                    .HasMaxLength(64)
                    .IsUnicode(false);
            });

            modelBuilder.Entity<TradeCommission>(entity =>
            {
                entity.HasKey(e => e.Id)
                    .HasName("PK_TRADECOMMISSION")
                    .ForSqlServerIsClustered(false);

                entity.Property(e => e.AddTime)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.AgentProjectPrice).HasColumnType("numeric(18, 2)");

                entity.Property(e => e.ModifyTime).HasColumnType("datetime");

                entity.Property(e => e.ProjectCode)
                    .HasMaxLength(16)
                    .IsUnicode(false);

                entity.Property(e => e.ProjectName)
                    .HasMaxLength(64)
                    .IsUnicode(false);

                entity.Property(e => e.ProjectPrice).HasColumnType("numeric(18, 2)");

                entity.Property(e => e.ProjectUnit)
                    .HasMaxLength(16)
                    .IsUnicode(false);
            });

            modelBuilder.Entity<UcalipayInCash>(entity =>
            {
                entity.HasKey(e => e.Id)
                    .HasName("PK_UCALIPAYINCASH")
                    .ForSqlServerIsClustered(false);

                entity.ToTable("UCAlipayInCash");

                entity.Property(e => e.AddTime)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.Data)
                    .HasMaxLength(32)
                    .IsUnicode(false);

                entity.Property(e => e.Ip4)
                    .HasColumnName("IP4")
                    .HasMaxLength(16)
                    .IsUnicode(false);

                entity.Property(e => e.ModifyTime).HasColumnType("datetime");

                entity.Property(e => e.Money)
                    .HasMaxLength(32)
                    .IsUnicode(false);

                entity.Property(e => e.Order)
                    .HasMaxLength(64)
                    .IsUnicode(false);

                entity.Property(e => e.Qrcode)
                    .HasColumnName("QRCode")
                    .HasMaxLength(128)
                    .IsUnicode(false);

                entity.Property(e => e.Remark)
                    .HasMaxLength(256)
                    .IsUnicode(false);

                entity.Property(e => e.Text)
                    .HasMaxLength(32)
                    .IsUnicode(false);

                entity.Property(e => e.Times)
                    .HasMaxLength(32)
                    .IsUnicode(false);

                entity.Property(e => e.UcalipayInCashId).HasColumnName("UCAlipayInCashId");
            });

            modelBuilder.Entity<UcexchangeRate>(entity =>
            {
                entity.HasKey(e => e.Id)
                    .HasName("PK_UCEXCHANGERATE")
                    .ForSqlServerIsClustered(false);

                entity.ToTable("UCExchangeRate");

                entity.Property(e => e.AddTime)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.ModifyTime).HasColumnType("datetime");

                entity.Property(e => e.ProjectCode)
                    .HasMaxLength(16)
                    .IsUnicode(false);

                entity.Property(e => e.ProjectName)
                    .HasMaxLength(64)
                    .IsUnicode(false);

                entity.Property(e => e.ProjectPrice).HasColumnType("numeric(18, 8)");

                entity.Property(e => e.ProjectTime).HasColumnType("date");
            });

            modelBuilder.Entity<UcexchangeRateManager>(entity =>
            {
                entity.ToTable("UCExchangeRateManager");

                entity.Property(e => e.AddTime).HasColumnType("datetime");

                entity.Property(e => e.ModifyTime).HasColumnType("datetime");
            });

            modelBuilder.Entity<UcinOutCash>(entity =>
            {
                entity.HasKey(e => e.Id)
                    .HasName("PK_UCINOUTCASH")
                    .ForSqlServerIsClustered(false);

                entity.ToTable("UCInOutCash");

                entity.Property(e => e.AddTime)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.AuditTime).HasColumnType("datetime");

                entity.Property(e => e.ExchangeRate).HasColumnType("numeric(18, 2)");

                entity.Property(e => e.Ip)
                    .HasColumnName("IP")
                    .HasMaxLength(16)
                    .IsUnicode(false);

                entity.Property(e => e.ManagerCardNo)
                    .HasMaxLength(32)
                    .IsUnicode(false);

                entity.Property(e => e.ManagerRealName)
                    .HasMaxLength(16)
                    .IsUnicode(false);

                entity.Property(e => e.ModifyTime).HasColumnType("datetime");

                entity.Property(e => e.Money).HasColumnType("numeric(18, 8)");

                entity.Property(e => e.MoneyType)
                    .HasMaxLength(16)
                    .IsUnicode(false);

                entity.Property(e => e.OrderNo)
                    .HasMaxLength(64)
                    .IsUnicode(false);

                entity.Property(e => e.Remark)
                    .HasMaxLength(256)
                    .IsUnicode(false);

                entity.Property(e => e.Rmbmoney)
                    .HasColumnName("RMBMoney")
                    .HasColumnType("numeric(18, 8)");

                entity.Property(e => e.UserBankProvince)
                    .HasMaxLength(16)
                    .IsUnicode(false);

                entity.Property(e => e.UserBankType)
                    .HasMaxLength(32)
                    .IsUnicode(false);

                entity.Property(e => e.UserCardNo)
                    .HasMaxLength(32)
                    .IsUnicode(false);

                entity.Property(e => e.UserName)
                    .HasMaxLength(32)
                    .IsUnicode(false);

                entity.Property(e => e.UserRealName)
                    .HasMaxLength(16)
                    .IsUnicode(false);
            });

            modelBuilder.Entity<Video>(entity =>
            {
                entity.HasKey(e => e.Id)
                    .HasName("PK_VIDEO")
                    .ForSqlServerIsClustered(false);

                entity.Property(e => e.AddTime)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.ModifyTime).HasColumnType("datetime");
            });
        }
    }
}
